import React from 'react'
import {BrowserRouter as Router,Route,Redirect} from 'react-router-dom'
// import AuthRoute from './components/AuthRoute'
// 导入首页和城市选择两个组件(页面)
import Home from './pages/Home'
import CityList from './pages/CityList'
import Map from './pages/Map'
import Profile from './pages/Profile'
import Login from './pages/Login'
import HouseDetail from './pages/HouseDetail'
// import Registe from './pages/Registe'

// 导入要使用的组件
function App() {
  return (
    <Router>
      <div className="App">
        {/* 路由重定向 */}
        <Route path="/" exact render={() => <Redirect to="/home"/>}></Route>
        {/* 配置路由 */}
        {/* Home 组件是父路由的内容 */}
        <Route path="/home" component={Home}></Route>
        <Route path="/citylist" component={CityList}></Route>
        <Route path="/map" component={Map}></Route>
        <Route path="/profile" component={Profile}></Route>

        {/* 房源详情的路由规则 */}
        <Route path="/login" component={Login}></Route>
        <Route path="/detail/:id" component={HouseDetail}></Route>
        {/* <Route path="/registe" component={Registe}></Route> */}
      </div>
    </Router>
  )   
}

export default App;
